

#include <iostream>

#include <cppunit/extensions/HelperMacros.h>

#include "../../tuxitty/src/Util.h"

#include <vector>
#include <algorithm>

typedef std::pair<wxString, wxString> StringPair;
typedef std::vector<StringPair > StringPairVector;

class UtilTest : public CppUnit::TestFixture
{
	CPPUNIT_TEST_SUITE( UtilTest );

	CPPUNIT_TEST( testToHex );

	CPPUNIT_TEST( testRandInt );

	CPPUNIT_TEST_SUITE_END();

public:

	void testToHex(){				
		wxString str = _T("zzz");
		CPPUNIT_ASSERT(StringUtil::ToHex(str).IsSameAs(_T("7a7a7a")));

		
		StringPairVector vec;

		vec.push_back(std::make_pair(_T("a"), _T("b")));
		vec.push_back(std::make_pair(_T("c"), _T("d")));

	//	printf("\r\n%d\r\n", vec.size());

	//	StringPairVector::iterator it = std::find_if(vec.begin(), vec.end(),  bind2nd(std::equal_to<wxString>(), _T("a")));

	//	if(it != vec.end()){
	//		printf("found\r\n");
	//	}
	}

	void testRandInt()
	{
		
	
		printf("%d\r\n", NumberUtil::RandInt());
		printf("%d\r\n", NumberUtil::RandInt());
		printf("%d\r\n", NumberUtil::RandInt(100));
	}

};


CPPUNIT_TEST_SUITE_REGISTRATION(UtilTest);
